[#include "/WEB-INF/pages/common/taglibs.ftl"]
[#--[@ckeditor.replace replace="template_editor" basePath="${base}/js/plugins/ckeditor/" initialized=false/>--]
<script type="text/javascript" src="[@c.url value='/js/plugins/ckeditor/ckeditor.js'/]"></script>

	<form action="[@c.url value="/manage/Template_${act}.action"/]?backurl=${backUrl}" method="post" class="stdform stdform2">
		<p>
        	<label>名称：</label>
            <span class="field"><input class="smallinput" type="text" placeholder="请输入模板名称" name="template.name" value="${(template.name)!''}"/></span>
        </p>
        <p>
        	<label>路径：<small>通过路径可以直接引用模板</small></label>
            <span class="field"><input type="text" readonly="readonly" placeholder="模板路径(自动生成)" name="template.path" value="${(template.path)!''}"/></span>
        </p>
        <p>
        	<label>类型：</label>
            <span class="field">
            	<select name="template.type">
					[#list typeList as t]
						<option [#if ((template.type)?? && t[1] == template.type) || type == t[1]]selected="selected"[/#if]  value="${t[1]}" >${t[0]}</option>
					[/#list]
				</select></span>
        </p>
        <p>
        	<label>可用：</label>
            <span class="field">
            	可用：<input type="radio" name="template.enabled" value="true" [#if template == null || (template.enabled ==true)]checked[/#if]/>&nbsp;&nbsp;&nbsp;
				禁用：<input type="radio" name="template.enabled" value="false" [#if (template != null && template.enabled == false)]checked[/#if]/>
			</span>
        </p>
        <p class="stdformbutton">
			<textarea class="longinput" cols="80" style="height: 86px;" id="template_editor" name="template.content" rows="40" >${((template.content)!'')?html}</textarea>
        </p>
	    <p class="stdformbutton">
	    	<input type="hidden" name="template.id" value="${(template.id)!''}" />
	    	<input type="hidden" name="id" value="${id}"/>
	      	<button class="submit ">提&nbsp;&nbsp;交</button>
	        <input type="reset" value="重&nbsp;&nbsp;置" class="reset radius2" />
	        <a class="anchorbutton button_alert" href="${action.backurl}" style="margin-left:6px;background-color: rgb(247, 247, 247); border-color: rgb(204, 204, 204); color: rgb(51, 51, 51);"><span style="background-color: rgb(255, 255, 255); border-color: rgb(221, 221, 221);">返&nbsp;&nbsp;回</span></a>
	    </p>
	</form> 
	<div>
	</div>
	<script type="text/javascript">
	//<![CDATA[
		$(function(){
			var theme = getTheme();
			//默认源码模式
			var config = {
						startupMode :'source',
						toolbar : 'Full', 
						toolbar_Full:[
							['Source','-','PageBreak', 'Preview','-','Templates','Maximize'],
							['PasteFromWord'],
							['Image','Flash','Table','HorizontalRule']
						],
						enterMode : CKEDITOR.ENTER_P,
						entities : false,
						templates_replaceContent:false,
					    //改变大小的最大高度
					    resize_maxHeight : 3000,
					    //改变大小的最大宽度
					    resize_maxWidth : 3000,
					    //改变大小的最小高度
					    resize_minHeight : 250,
					    //改变大小的最小宽度
					    resize_minWidth : 750,
					    baseFloatZIndex : 299,
					    //textarea内容自动更新
    					autoUpdateElement : true,
    					//※自动warp指定tag
    					autoParagraph : false,
    					//是否忽略段落中的空字符
    					ignoreEmptyParagraph :false,
    					//是否强制复制来的内容去除格式 plugins/pastetext/plugin.js
    					forcePasteAsPlainText:false,
    					//是否使用完整的html编辑模式 如使用，其源码将包含：<html><body></body></html>等标签 
    					fullPage : false,
    					//word不过滤字符样式
    					pasteFromWordRemoveStyles:false,
    					pasteFromWordRemoveFontStyles:false,
    					format_pre : { element : 'pre', attributes : { 'class' : 'code' } }
				};
						//var config = {};
			// protect <anytag class="*"></anytag>
			//对应后台语言的类型来对输出的HTML内容进行格式化
			//CKEDITOR.config.protectedSource.push( /[\#[\s\S]*?\?>/g );   
			//CKEDITOR.config.protectedSource.push( /<([\S]+)[^>]*style="[.*]"[^>]*>.*<\/\1>/g );
			// protect <anytag class="*" /><
			//CKEDITOR.config.protectedSource.push( /<[^>]+style="[.*]"[^>\/]*\/>/g );
			
			var editor = CKEDITOR.replace('template_editor', config);
			var content = CKEDITOR.instances.template_editor;
		});
	//]]></script>
<div style="clear:both;"></div>
